package com.training.java.core.collections.post15;

import java.util.Set;
import java.util.TreeSet;

/**
 * 
 * This demo is to observe how TreeSet is displaying the values. TreeSet type
 * should not take null. Maintains the objects in alphabetical order.
 * 
 * @author soumya
 * 
 */
public class TelevisionTreeSetDemo {

	public static void main(String[] args) {
		TelevisionMutable television1 = new TelevisionMutable("Samsung", "LED",
				false, 1500);
		TelevisionMutable television2 = new TelevisionMutable("Philips", "LCD",
				true, 2500);
		TelevisionMutable television3 = new TelevisionMutable("Sony", "LED",
				true, 3500);
		TelevisionMutable television4 = new TelevisionMutable("Sony", "LED",
				false, 3500);

		Set<TelevisionMutable> televisions = new TreeSet<TelevisionMutable>();

		// List<TelevisionMutable> televisions = new
		// ArrayList<TelevisionMutable>();

		televisions.add(television1);
		televisions.add(television2);
		televisions.add(television3);
		televisions.add(television4);

		for (TelevisionMutable television : televisions) {

			System.out.println("Television company : "
					+ television.getCompany());
			System.out.println("Television type : " + television.getType());
			System.out.println("Television Enabled 3D : "
					+ television1.isEnabled3D());
			System.out.println("Television price : " + television.getPrice());

			System.out.println("  ");

		}

	}

}